import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 23735
 * Date: 2023-10-13
 * Time: 22:33
 */
public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 先求出 [0, 1000] 之间的所有素数
        List<Integer> list = new ArrayList<>();
        findPrime(list);
        Set<Integer> set = new HashSet<>(list); // 使用 set 将所有素数存起来
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int half = n / 2;
            // 使用二分查找，找到最接近但是小于等于 half 的素数
            int left = 0;
            int right = list.size() - 1;
            while (left < right) {
                int mid = ((right-left+1)>>1) + left;
                if (list.get(mid) > half) {
                    right = mid - 1;
                } else {
                    left = mid;
                }
            }
            // 最终 right 所在位置就是 最接近但是小于等于 half 的素数
            while (right >= 0) {
                if (set.contains(n - list.get(right))) {
                    System.out.println(list.get(right));
                    System.out.println(n - list.get(right));
                    break;
                }
                right--;
            }
        }
    }

    private static void findPrime(List<Integer> list) {
        for (int i = 2; i <= 1000; i++) {
            // 判断是否是素数
            boolean flag = true;
            for (int j = 2; j <= Math.sqrt(i); j++) {
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                list.add(i);
            }
        }
    }
}
